<?php
$csv->addRow($Th_name);
foreach ($td as $t) {
    $csv->addRow();
    $csv->addField($t['MUser']['id']);
    $csv->addField($t['MUser']['user_id']);
    $csv->addField($t['MUser']['user_name']);
    $csv->addField($t['MUser']['user_name_kata']);
    $csv->addField($t['MUser']['password']);
    $csv->addField($t['MUser']['email_address']);
    $csv->addField($t['MUser']['creator']);
    $csv->addField($t['MUser']['create_time']);
    $csv->addField($t['MUser']['updator']);
    $csv->addField($t['MUser']['update_time']);
    $csv->addField($t['MUser']['invalid_flg']);
    $csv->endRow();
}
$csv -> setFilename ($filename);
echo $csv->render(true,'UTF-8');
?>